<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div id="box">
        <ul>
            <li 
                v-for="(item,index) in list" 
                :class="current===index?'active':''" 
                @click="change(index)"
            >
                {{item}}
            </li>
        </ul>
    </div>
    <script>
        var vm = new Vue({
            el:"#box",
            data:{
                list:["首页","商品","详情"],
                current:0
            },
            methods:{
                change(index){
                    this.current = index;
                } 
            }
        });
    </script>
</body>
</html>